/**
 * @author Clark
 * @email haixuanwoTxh@gmail.com
 * @date 2021-10-30
 */
#include <stdio.h>

#define IN 1    // 在单词内
#define OUT 0   // 在单词外

int main(int argc, char *argv[])
{
    int c, nl, nw, nc, state;

    state = OUT;
    nl = nw = nc = 0;

    while ((c = getchar()) != EOF)
    {
        ++nc;
        if (c == '\n')
          ++nl;

        if (' ' == c || '\n' == c || '\t' == c)
          state = OUT;
        else if (OUT == state)
        {
            state = IN;
            ++nw;
        }
    }

    printf("line[%d] word[%d] char[%d]\n", nl, nw, nc);
    return 0;
}

